cmake_minimum_required(VERSION 3.16)

project(pthread_linux_test LANGUAGES C)

# 查找Threads库（包含pthread支持）
find_package(Threads REQUIRED)
if (Threads_FOUND)
    message(STATUS "成功找到Threads库")
endif()

add_executable(pthread_linux_test main.c
    threadpool.c threadpool.h
)

# 链接Threads库到可执行文件
target_link_libraries(pthread_linux_test Threads::Threads)

include(GNUInstallDirs)
install(TARGETS pthread_linux_test
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
